<?php

error_reporting(E_ALL);

/**
 * untitledModel - class.ControladorActividad.php
 *
 * $Id$
 *
 * This file is part of untitledModel.
 *
 * Automatically generated on 06.12.2011, 16:06:23 with ArgoUML PHP module 
 * (last revised $Date: 2010-01-12 20:14:42 +0100 (Tue, 12 Jan 2010) $)
 *
 * @author firstname and lastname of author, <author@example.org>
 */

if (0 > version_compare(PHP_VERSION, '5')) {
    die('This file was generated for PHP 5');
}

/**
 * include Actividades
 *
 * @author firstname and lastname of author, <author@example.org>
 */
require_once('class.Actividades.php');

/**
 * include ModeloActividades
 *
 * @author firstname and lastname of author, <author@example.org>
 */
require_once('class.ModeloActividades.php');

/**
 * include Usuarios
 *
 * @author firstname and lastname of author, <author@example.org>
 */
require_once('class.Usuarios.php');

/**
 * include VistaActividades
 *
 * @author firstname and lastname of author, <author@example.org>
 */
require_once('class.VistaActividades.php');

/* user defined includes */
// section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B2C-includes begin
// section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B2C-includes end

/* user defined constants */
// section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B2C-constants begin
// section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B2C-constants end

/**
 * Short description of class ControladorActividad
 *
 * @access public
 * @author firstname and lastname of author, <author@example.org>
 */
class ControladorActividades
{
    // --- ASSOCIATIONS ---


    // --- ATTRIBUTES ---

    /**
     * Short description of attribute modelo
     *
     * @access public
     * @var ModeloActividades
     */
    public $modelo = null;

    /**
     * Short description of attribute vista
     *
     * @access public
     * @var VistaActividades
     */
    public $vista = null;

    /**
     * Short description of attribute actividades
     *
     * @access public
     * @var Actividades
     */
    public $actividades = null;

    /**
     * Short description of attribute usuarios
     *
     * @access public
     * @var Usuarios
     */
    public $usuarios = null;

    /**
     * Short description of attribute mensaje
     *
     * @access public
     * @var String
     */
    public $mensaje = null;

    // --- OPERATIONS ---

    /**
     * Short description of method Lista
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function Lista()
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B3B begin

		$cadena=$this->modelo->GetAllRows();
		
		$this->vista->Lista("header.php",$cadena);
		$this->vista->Lista("VistaListaActividades.php",$cadena);
		$this->vista->Lista("footer.php",$cadena);
		exit();
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B3B end
    }

    /**
     * Short description of method Alta
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function Alta($datos)
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B3D begin
		$this->modelo->InsertRow($datos);
			$this->Lista();
			$this->mensaje="Actividad registrado con Exito";
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B3D end
    }

  public function Mostrar()
    {
        // section 10-0-101-116-75074dcc:133e14e2698:-8000:00000000000017A6 begin
	
			$this->vista->Alta("header.php");
			$this->vista->Alta("VistaAltaActividades.php");
			$this->vista->Alta("footer.php");
				exit();
	
        // section 10-0-101-116-75074dcc:133e14e2698:-8000:00000000000017A6 end
    }
	 public function MostrarBorrar($valorid)
    {
        // section 10-0-101-116-75074dcc:133e14e2698:-8000:00000000000017A6 begin
				$cadena= $this->modelo->GetId($valorid);				
				$this->vista->Borrar("header.php",$cadena);
				$this->vista->Borrar("VistaBajaActividades.php",$cadena);
				$this->vista->Borrar("footer.php",$cadena);
				exit();
				
	
        // section 10-0-101-116-75074dcc:133e14e2698:-8000:00000000000017A6 end
    }
	public function MostrarEditar($valorid)
    {
        // section 10-0-101-116-75074dcc:133e14e2698:-8000:00000000000017A6 begin
	
				$cadena= $this->modelo->GetId($valorid);
				$this->vista->Editar("header.php",$cadena);
				$this->vista->Editar("VistaEditarActividades.php",$cadena);
				$this->vista->Editar("footer.php",$cadena);
				exit();
				
	
        // section 10-0-101-116-75074dcc:133e14e2698:-8000:00000000000017A6 end
    }
    /**
     * Short description of method Borrar
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function Borrar($id)
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B3F begin
		$this->modelo->DeleteRow($id);
		$this->Lista();
		exit();
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B3F end
    }

    /**
     * Short description of method Buscar
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function Buscar()
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B41 begin
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B41 end
    }

    /**
     * Short description of method Editar
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function Editar($datos)
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B43 begin
		$this->modelo->UpdateRow($datos);
			$this->Lista();
			exit();
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B43 end
    }

    /**
     * Short description of method ControladorActividad
     *
     * @access public
     * @author firstname and lastname of author, <author@example.org>
     * @return mixed
     */
    public function ControladorActividades()
    {
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B45 begin
		$this->modelo = new ModeloActividades();		
		$this->vista = new VistaActividades();
		$this->usuarios = new Usuarios();
		$this->actividades = new Actividades();
		
		if ($this->usuarios->IsLogged()==true && @$_REQUEST['opcion'] == null && @$_REQUEST['registroact'] == null && @$_REQUEST['borrar'] == null && @$_REQUEST['editaract'] == null && @$_REQUEST['borraract'] == null) 
		{	
				$this->Lista();
		}else
		{
			if(@$_REQUEST['salir'] != null)
			{
				$this->usuario->LogOut();
			}
			elseif(@$_REQUEST['opcion'] == 'agregar')
			{
				$this->Mostrar();
			}
			elseif(@$_REQUEST['registroact'] != null)
			{
				$this->Alta($_REQUEST);
			}
			elseif(@$_REQUEST['opcion'] == 'desplegar')
			{
				if(@$_REQUEST['dato']== 1){
				$this->MostrarBorrar(@$_REQUEST['id']);
				}
				if(@$_REQUEST['dato']== 2){
				$this->MostrarEditar(@$_REQUEST['id']);
				}
			}
			elseif(@$_REQUEST['editaract'] != null)
			{
				$this->Editar($_REQUEST);
			}
			elseif(@$_REQUEST['borraract'] != null)
			{
				$this->Borrar(@$_REQUEST['idactividad']);
			}
		}
        // section -64--88-1-105--75424b28:1340c1872aa:-8000:0000000000000B45 end
    }

} /* end of class ControladorActividad */

?>